import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';

const getDirname = (metaUrl) => path.dirname(fileURLToPath(new URL(metaUrl)));

const currentDir = getDirname(import.meta.url);

const fileName = '2025-chongyang';

const fileText = fs.readFileSync(path.resolve(currentDir, `../${fileName}.txt`), { encoding: 'utf-8' });
const base64 = fileText.replace(`data:image/png;base64,`, '');
const sourceBuffer = Buffer.from(base64, 'base64');
fs.writeFileSync(path.resolve(currentDir, `../${fileName}.zip`), sourceBuffer);
